extends "../calxJS_Hide/calxJS_Hide.gd"
func _init():
	pass
func _extInit():
	._extInit()
	chaName = "玄武"                   # 角色的名称
	attCoe.atkRan = 1                 # 攻击距离
	attCoe.maxHp = 6                  # 最大生命（每点代表112.5基础数值，取整数，下同）
	attCoe.atk = 5                   # 攻击力（每点代表8.5）
	attCoe.mgiAtk = 1.5                 # 魔法攻击（每点代表13.7）
	attCoe.def = 6                    # 物理防御（每点代表15）
	attCoe.mgiDef = 6                 # 魔法防御（每点代表16.6）
	atkEff = "atk_dang" 
	xb = "水"
	lv = 4    
	addSkillTxt("[海流漩涡]海流漩涡卷中对方单体，造成100%水系物理伤害，若目标体力高于60%，则减少80%冷却[CD:8]")
	addSkillTxt("[玄冥灵甲]<先发>提升自身30%伤害减免，持续5秒，效果结束后恢复15%最大体力值[CD:14]")
	addSkillTxt("[水盾]提升我方全体双防20%,持续6秒[CD:12]")
	addSkillTxt("[color=#FFFF00][玄冥惊涛][/color]:[color=#FFCC22]引导体内上古玄冥之力，发射出水柱攻击目标以及目标周围一格，造成200&水系物理伤害\n随后嘲讽被击中的目标5秒，并清除增益[CD:17][/color]")
	addCdSkill("xuanwo",8) 
	addCdSkill("lingjia",14)
	addCdSkill("shuidun",12)
	addCdSkill("jingtao",17)  

func _castCdSkill(id):
	._castCdSkill(id)
	if id == "xuanwo":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("海流漩涡", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		typeHurtCha(aiCha,att.atk*1.0,Chara.HurtType.PHY,Chara.AtkType.SKILL)
		if aiCha.att.hp/aiCha.att.maxHp > aiCha.att.maxHp * 0.6:
			var sk = getSkill("xuanwo") 
			sk.nowTime += sk.cd*0.8
	if id == "lingjia":
		lingjia()
	if id == "shuidun":
		var chas = getAllChas(2)
		for i in chas:
			i.addBuff(shuidun1.new(6))
	if id == "jingtao":
		var eff = sys.newEff("numHit", position, false, 1)
		eff.setText("玄冥惊涛", "#FF0099")
		eff.anim.set_speed_scale(0.2)
		var chas = getAnCellChas(aiCha.cell,1,1)
		for i in chas:
			typeHurtCha(i,att.atk*2,Chara.HurtType.PHY,Chara.AtkType.SKILL) 
			i.addBuff(b_taunt.new(5, self))
			i.aiCha = self 
			if sys.rndPer(100):
				for j in i.buffs:
					if not j.isNegetive && j.get("type") != config.EQUITYPE_EQUI && j.get("dispelable") != true:
						j.isDel = true


func lingjia():
	var eff = sys.newEff("numHit", position, false, 1)
	eff.setText("玄冥灵甲", "#FF0099")
	eff.anim.set_speed_scale(0.2)
	addBuff(jianmian.new(5))
	yield(reTimer(5),"timeout")
	plusHp(att.maxHp*0.15)

func _onBattleStart():
	._onBattleStart()
	lingjia()

class shuidun1:
	extends Buff
	func _init(lv=1):
		attInit()
		var dispelable = false
		id = "shuidun1"
		life = lv
		isNegetive=false
		att.defL += 0.2
		att.mgiDefL += 0.2

class jianmian:
	extends Buff
	func _init(lv=1):
		attInit()
		var dispelable = false
		life = lv
		isNegetive=false
		id = "jianmian"	
		att.defR += 0.3

class b_taunt:
	extends Buff
	var tcha
	func _init(lv = 1, tcha = null):
		life = lv
		isNegetive = true
		self.tcha = tcha
		id = "b_taunt"
	func _del():
		masCha.aiCha = null
		._del()
	func _upS():
		if tcha.isDeath:
			life = 0
		elif masCha.aiCha != tcha:
			masCha.aiCha = tcha
